import java.io.Serializable;

/**
 * 对象想要序列化必须要实现Serializable这个接口
 * 这个接口其实没有任何实际内容,就是起一个标记作用,使用java自带的写入对象规则
 */
public class Student implements Serializable {
    //可以用transient修饰符选择成员变量不参与序列化

    //因为类是会后期更新的,所以存在文件中的数据未必是最新的版本,所以存在序列化的版本号
    //只有序列化的版本号和文件的版本号一致才不会报错
    private static final long serialVersionUID = 1;
    private String name;
    private int age;
    private double height;
    private double weight;

    public Student() {
    }

    public Student(String name, int age, double height, double weight) {
        this.name = name;
        this.age = age;
        this.height = height;
        this.weight = weight;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", height=" + height +
                ", weight=" + weight +
                '}';
    }
}
